/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package edu.upn.sigemfi.vnf.be;

import java.io.Serializable;
import javax.persistence.Column;
import javax.persistence.DiscriminatorValue;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.JoinColumn;
import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery;
import javax.persistence.OneToOne;
import javax.persistence.PrimaryKeyJoinColumn;
import javax.persistence.Table;

/**
 *
 * @author Administrador
 */
@Entity
@Table(name = "VNF_GIRO")
@NamedQueries({@NamedQuery(name = "Giro.findAll", query = "SELECT g FROM Giro g"),
    @NamedQuery(name = "Giro.findByIdGiro", query = "SELECT g FROM Giro g WHERE g.idGiro = :idGiro"),
    @NamedQuery(name = "Giro.findByTipoGiro", query = "SELECT g FROM Giro g WHERE g.tipoGiro = :tipoGiro"),
    @NamedQuery(name = "Giro.findByNombreEmisor", query = "SELECT g FROM Giro g WHERE g.nombreEmisor = :nombreEmisor"),
    @NamedQuery(name = "Giro.findByApellidosEmisor", query = "SELECT g FROM Giro g WHERE g.apellidosEmisor = :apellidosEmisor"),
    @NamedQuery(name = "Giro.findByDniEmisor", query = "SELECT g FROM Giro g WHERE g.dniEmisor = :dniEmisor"),
    @NamedQuery(name = "Giro.findByNombreReceptor", query = "SELECT g FROM Giro g WHERE g.nombreReceptor = :nombreReceptor"),
    @NamedQuery(name = "Giro.findByApellidosReceptor", query = "SELECT g FROM Giro g WHERE g.apellidosReceptor = :apellidosReceptor"),
    @NamedQuery(name = "Giro.findByTipoMoneda", query = "SELECT g FROM Giro g WHERE g.tipoMoneda = :tipoMoneda")
})
@PrimaryKeyJoinColumn(name = "ID_GIRO", referencedColumnName = "ID_TRANSACCION_NF")
@DiscriminatorValue("GI")
public class Giro extends TransaccionNoFinanciera implements Serializable {

    @Column(name = "TIPO_GIRO")
    private String tipoGiro;
    @Column(name = "NOMBRE_EMISOR")
    private String nombreEmisor;
    @Column(name = "APELLIDOS_EMISOR")
    private String apellidosEmisor;
    @Column(name = "DOC_EMISOR")
    private String docEmisor;
    @Column(name = "NOMBRE_RECEPTOR")
    private String nombreReceptor;
    @Column(name = "APELLIDOS_RECEPTOR")
    private String apellidosReceptor;
    @Column(name = "TIPO_MONEDA")
    private String tipoMoneda;
    @Column(name = "TIPO_DOCUMENTO")
    private String tipoDocumento;
    @Column(name= "FID_SEG_AGENCIA")
    private int segAgencia;
    //id TransaccionNoFinanciera
    @JoinColumn(name = "ID_GIRO", referencedColumnName = "ID_TRANSACCION_NF", nullable = false, insertable = false, updatable = false)
    @OneToOne(optional = false, fetch = FetchType.LAZY)
    private TransaccionNoFinanciera transaccionNoFinanciera;

    public Giro() {
    }

    public String getTipoGiro() {
        return tipoGiro;
    }

    public void setTipoGiro(String tipoGiro) {
        this.tipoGiro = tipoGiro;
    }

    public int getSegAgencia() {
        return segAgencia;
    }

    public void setSegAgencia(int segAgencia) {
        this.segAgencia = segAgencia;
    }

    public String getNombreEmisor() {
        return nombreEmisor;
    }

    public void setNombreEmisor(String nombreEmisor) {
        this.nombreEmisor = nombreEmisor;
    }

    public String getApellidosEmisor() {
        return apellidosEmisor;
    }

    public void setApellidosEmisor(String apellidosEmisor) {
        this.apellidosEmisor = apellidosEmisor;
    }

    public String getDocEmisor() {
        return docEmisor;
    }

    public void setDocEmisor(String docEmisor) {
        this.docEmisor = docEmisor;
    }

    public String getTipoDocumento() {
        return tipoDocumento;
    }

    public void setTipoDocumento(String tipoDocumento) {
        this.tipoDocumento = tipoDocumento;
    }

  

    public String getNombreReceptor() {
        return nombreReceptor;
    }

    public void setNombreReceptor(String nombreReceptor) {
        this.nombreReceptor = nombreReceptor;
    }

    public String getApellidosReceptor() {
        return apellidosReceptor;
    }

    public void setApellidosReceptor(String apellidosReceptor) {
        this.apellidosReceptor = apellidosReceptor;
    }

    public String getTipoMoneda() {
        return tipoMoneda;
    }

    public void setTipoMoneda(String tipoMoneda) {
        this.tipoMoneda = tipoMoneda;
    }

    public TransaccionNoFinanciera getTransaccionNoFinanciera() {
        return transaccionNoFinanciera;
    }

    public void setTransaccionNoFinanciera(TransaccionNoFinanciera TransaccionNoFinanciera) {
        this.transaccionNoFinanciera = TransaccionNoFinanciera;
    }

    @Override
    public int hashCode() {
        int hash = 0;
        hash += (idTransaccionNf != null ? idTransaccionNf.hashCode() : 0);
        return hash;
    }

    @Override
    public boolean equals(Object object) {
        // TODO: Warning - this method won't work in the case the id fields are not set
        if (!(object instanceof TransaccionNoFinanciera)) {
            return false;
        }
        TransaccionNoFinanciera other = (TransaccionNoFinanciera) object;
        if ((this.idTransaccionNf == null && other.idTransaccionNf != null) || (this.idTransaccionNf != null && !this.idTransaccionNf.equals(other.idTransaccionNf))) {
            return false;
        }
        return true;
    }

    @Override
    public String toString() {
        return "edu.upn.sigemfi.vnf.be.TransaccionNoFinanciera[idTransaccionNf=" + idTransaccionNf + "]";
    }
}
